package com.xuexiang.xuidemo.factory;

import com.xuexiang.xuidemo.MyApplication;
import com.xuexiang.xuidemo.provider.GridProviderImpl;
import com.xuexiang.xuidemo.util.Constants;

import ohos.app.Context;

public class AdapterFactory {

    private static class HOLDER {
        private static final AdapterFactory HOLDER = new AdapterFactory();
    }

    public static AdapterFactory getInstance() {
        return HOLDER.HOLDER;
    }

    public GridProviderImpl getAssemblyAdapter(Context context) {
        return new GridProviderImpl(context) {
            @Override
            protected String[] getTitle() {
                return new Constants().assemblyTitles;
            }

            @Override
            protected Integer[] getIconId() {
                return  new Constants().assemblyIcons;
            }
        };
    }

    public GridProviderImpl getToolAdapter(Context context) {
        return new GridProviderImpl(context) {
            @Override
            protected String[] getTitle() {
                return  new Constants().toolTitle;
            }

            @Override
            protected Integer[] getIconId() {
                return  new Constants().toolIcons;
            }
        };
    }

    public GridProviderImpl getExpandAdapter(Context context) {
        return new GridProviderImpl(context) {
            @Override
            protected String[] getTitle() {
                return  new Constants().expandTitle;
            }

            @Override
            protected Integer[] getIconId() {
                return  new Constants().expandIcons;
            }
        };
    }

}
